var loginid,loginuser,loginname,loginkey;
var isjump = 0;//控制翻页
var jumpobj;//跳转对象（page_r 充值  page_c 消费）
var alertmsg = "";
var bigtext ="";//获取城市
var store_image ="";
layui.config({
	version:'1510164124181'
}).use(['form','laydate', 'layer', 'element','upload'],function(){
	form = layui.form;
	layer = layui.layer;
    laydate = layui.laydate;//日期
    element = layui.element; //元素操作
    upload = layui.upload;//上传
	loginid = $.session.get("userid");
	loginuser = $.session.get("admin_realname");
	loginname = $.session.get("username");
	loginkey = $.session.get("user_secretkey");
	ediet_depositid = $.session.get("ediet_depositid");
	initdatas();
});
//初始化数据
function initdatas(){
    var index = top.layer.msg('加载中，请稍候',{icon: 16,time:false,shade:0.8});
	$.ajax({
		url: "../../../../service",
		cache: false,
		async: false,
		data: {
			proc: "c_admin.h_depositask_selbyid",
			para: "['" + loginname + "','" + loginkey + "',"+(ediet_depositid*1)+"]"
		},
		dataType: "json",
		success: function(data) {
			top.layer.closeAll();
			console.log(JSON.stringify(data))
			if(data[0].TAG=='0'){
				top.layer.alert(""+data[0].MSG+"",function(index){
				   top.location.href="login.html";
				   layer.close(index);
			    });
			}else if(data[0].TAG=='2'){
			   layer.msg(""+data[0].MSG+"");
			}else if(data[0].msg=='读取接口失败,参数错误'||data.msg=='读取接口失败,参数错误'){
			}else{
			   $("#ask_number").val(data[0].ASK_NUMBER);
			   $("#u_id").val(data[0].U_ID);
			   $("#bank_cardnumber").val(data[0].BANK_CARDNUMBER);
			   $("#band_branch").val(data[0].BAND_BRANCH);
			   $("#tel").val(data[0].TEL);
			   $("#deposit_money").val((Math.floor(data[0].DEPOSIT_MONEY * 100) / 100));
			   $("#deposit_type").val(data[0].DEPOSIT_TYPE);
			   $("#deposit_time").val(data[0].DEPOSIT_TIME);
			   $("#real_name").val(data[0].REAL_NAME);
			   $("#ask_state").val(data[0].ASK_STATE);
			}

		}
	});
}
//审核
function update(){
	 var state = $("#ask_state").val();
	 //console.log("['" + loginname + "','" + loginkey + "','"+ediet_depositid+"','"+state+"']");
    top.layer.confirm('您确定要提交此次审核吗？',{icon: 3,title:'提示信息'},function(index){
		var index = top.layer.msg('审核中，请稍候',{icon: 16,time:false,shade:0.8});
		setTimeout(function(){
			$.ajax({
				url: "../../../../service",
				cache: false,
				data: {
					proc: "c_admin.h_depositask_updatebyid",
					para: "['" + loginname + "','" + loginkey + "','"+ediet_depositid+"','"+state+"']"
				},
				dataType: "json",
				success: function(data) {
					console.log("====="+JSON.stringify(data));
                    top.layer.closeAll();
					if(data[0].TAG=='0'){
						top.layer.alert(""+data[0].MSG+"",function(index){
						   top.location.href="login.html";
						   layer.close(index);
					    });
					}else if(data[0].msg=='读取接口失败,参数错误'||data.msg=='读取接口失败,参数错误'){
						top.layer.msg("修改失败，请检查您的网络环境!");
						console.log("读取接口失败,参数错误");
					}else if(data[0].TAG == 2){
						top.layer.msg(""+data[0].MSG+"");
					}else{
						top.layer.msg(""+data[0].MSG+"");
						returnlist();
					}
				}
			});
		},1000);
	})
}

//返回
function returnlist(){
	$.session.remove("ediet_depositid");
	window.location.href="withdrawal.html";
}
